package cn.community.care.module.system.dal.mysql.task;

import java.util.*;

import cn.community.care.framework.common.pojo.PageResult;
import cn.community.care.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.community.care.framework.mybatis.core.mapper.BaseMapperX;
import cn.community.care.module.system.controller.admin.task.vo.TaskPageReqVO;
import cn.community.care.module.system.dal.dataobject.task.TaskDO;
import org.apache.ibatis.annotations.Mapper;

/**
 * 任务 Mapper
 *
 * @author 超级管理员
 */
@Mapper
public interface TaskMapper extends BaseMapperX<TaskDO> {

    default PageResult<TaskDO> selectPage(TaskPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<TaskDO>()
                .likeIfPresent(TaskDO::getTaskName, reqVO.getTaskName())
                .eqIfPresent(TaskDO::getAssigneeId, reqVO.getAssigneeId())
                .eqIfPresent(TaskDO::getServiceId, reqVO.getServiceId())
                .eqIfPresent(TaskDO::getStatus, reqVO.getStatus())
                .betweenIfPresent(TaskDO::getCreateTime, reqVO.getCreateTime())
                .eqIfPresent(TaskDO::getCreator, reqVO.getCreator())
                .orderByDesc(TaskDO::getId));
    }

}